package com.yinhai.ta404.module.hunan.userarea.service.read.impl;

import com.yinhai.ta404.component.org.orguser.area.entity.TaAreaPo;
import com.yinhai.ta404.core.exception.AppException;
import com.yinhai.ta404.core.service.BaseService;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import com.yinhai.ta404.core.utils.ValidateUtil;
import com.yinhai.ta404.module.hunan.userarea.mapper.read.UserAreaReadMapper;
import com.yinhai.ta404.module.hunan.userarea.service.read.UserAreaReadService;
import com.yinhai.ta404.module.hunan.userarea.vo.TaUserAreaVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
@TaTransactional(
        readOnly = true
)
public class UserAreaReadServiceImpl extends BaseService implements UserAreaReadService {
    @Resource
    private UserAreaReadMapper userAreaReadMapper;


    @Override
    public List<TaUserAreaVo> queryUserAreaByUserId(String userId) {
        if(ValidateUtil.isEmpty(userId)){
            throw new AppException("用户编号为空");
        }
        return userAreaReadMapper.queryUserAreaByUserId(userId);
    }

    @Override
    public List<TaAreaPo> queryAreaByUserId(String userId) {
        if(ValidateUtil.isEmpty(userId)){
            throw new AppException("用户编号为空");
        }
        return userAreaReadMapper.queryAreaByUserId(userId);
    }
}
